# encoding: utf-8
from flask_marshmallow import base_fields

from flask_restplus_patched import ModelSchema
from app.modules.common.schemas import BaseSchema
from .models import PlanTest


class AutoTestBaseSchema(ModelSchema):
    class Meta:
        model = PlanTest
        fields = (
            'id',
            'plan_id',
            'plan_name',
            'agent_id',
            'agent_ip',
            'create_time',
            'creater_account',
            'creater_realname',
            'case_names',
            'case_ids',
            'root_case',
            'total',
            'success',
            'fail',
            'report_path',
            'tags',
            'desc',
        )


class AutoTestListSchema(BaseSchema):
    data = base_fields.Nested(
        AutoTestBaseSchema,
        many = True
    )

    class Meta:
        fields = BaseSchema.Meta.fields + (
            'data',
        )
